<?php
Authenticate::requireUser();
$db = Db::getInstance();
$query = sprintf("SELECT * FROM Topic WHERE accountId='%s' ORDER BY createTime DESC", $db->real_escape_string(Authenticate::getId()));
$result = $db->query($query);
$topics = array();
$readNew = 0;
while($row = $result->fetch_assoc()){
    $topics[] = $row;
    if($row['readNew']==1) $readNew++;
}
View::display('user/qa', array('topics'=> $topics));